package com.rojored.controls.plotClasses 
{

import flash.display.ShaderData;
import flash.display.ShaderParameter;
import org.hamcrest.assertThat;
import org.hamcrest.collection.array;
import org.hamcrest.number.closeTo;

/**
 *  Test basic shader operations.
 */
public class PlotShaderBaseTest extends PlotShaderBase
{

    //--------------------------------------------------------------------------
    //
    //  Class variables
    //
    //--------------------------------------------------------------------------

    [Embed(source="TestShader.pbj", mimeType="application/octet-stream")]

    /**
     *  @private
     *  Embedded shader bytes.
     */
    public static var TestShader:Class;

    //--------------------------------------------------------------------------
    //
    //  Constructor
    //
    //--------------------------------------------------------------------------

    /**
     *  Constructor
     */
    public function PlotShaderBaseTest() 
    {
        super(new TestShader());
    }

    //--------------------------------------------------------------------------
    //
    //  Methods
    //
    //--------------------------------------------------------------------------

    [Test(description="Test line color configuration")]
    
    /**
     *  Test line color configuration
     */
    public function testColorCalculation():void
    {
        lineColor = 0xFF0000;
        lineAlpha = 1.0;
        assertThat("Solid red:", lineRGBA[0], closeTo(1, 0.01));
        assertThat("Solid red:", lineRGBA[1], closeTo(0, 0.01));
        assertThat("Solid red:", lineRGBA[2], closeTo(0, 0.01));
        assertThat("Solid red:", lineRGBA[3], closeTo(1, 0.01));

        backgroundColor = 0x00FF00;
        backgroundAlpha = 1.0;
        assertThat("Solid green:", backgroundRGBA[0], closeTo(0, 0.01));
        assertThat("Solid green:", backgroundRGBA[1], closeTo(1, 0.01));
        assertThat("Solid green:", backgroundRGBA[2], closeTo(0, 0.01));
        assertThat("Solid green:", backgroundRGBA[3], closeTo(1, 0.01));
    }
}
}
